<script>
var _lotto_id = {lotto_id};
var _r46R1passNameArr = new Array("大", "小", "单", "双", "质", "合");
$.fn.chkR1pass = function(){
  var chkP1 = $("tbody#tbd001 input.r46_P1:checked");
  var chkP2 = $("tbody#tbd001 input.r46_P2:checked");
  var chkP3 = $("tbody#tbd001 input.r46_P3:checked");
  if($(chkP1).size() == 1 && $(chkP2).size() == 1 && $(chkP3).size() == 1){
    var chkVal3 = $(chkP3).val();
    var chkVal2 = $(chkP2).val();
    var chkVal1 = $(chkP1).val();
    var idxVal1 = chkVal1 % 6;
    var idxVal2 = chkVal2 % 6;
    var idxVal3 = chkVal3 % 6;
    var chkRate =  Math.floor(( ($("tbody#tbd001 td#td_r46_"+chkVal1).text() - 0) * ($("tbody#tbd001 td#td_r46_"+chkVal2).text() - 0) * ($("tbody#tbd001 td#td_r46_"+chkVal3).text() - 0)  ) * 100) / 100;
    var chkStr = '勾选内容: <font color=blue>佰' + _r46R1passNameArr[idxVal1] + 'X 拾' +  _r46R1passNameArr[idxVal2] + 'X 个' +  _r46R1passNameArr[idxVal3];
    chkStr = chkStr + '</font>, 赔率为: <font color=red>' + chkRate + '</font>&nbsp;&nbsp;&nbsp;';
    $("#chkr1passMsg").html(chkStr);
    $("form input:submit").removeAttr("disabled");
  }else{
    $("#chkr1passMsg").empty();
    $("form input:submit").attr("disabled", "true");
  }

};

// 表格
$(function(){
  $("div#mainPageData").hide();
  $("#spanChgBetBtn").hide();
  $("form").unbind("submit");   // 取消 submit的检查

  
  $("div#errormsg").text("赔率更新中...请稍等...");

  // 取得赔率资料
  $().getMydata(_lotto_id,_gametype);
  
  // 切换赔率
  $("select#slcDisk").change(function(){
    $("input#disk").attr("value",$("select#slcDisk option:selected").val());
    $().getMydata(_lotto_id,_gametype);
    
  });
  
  // 取消
  $("input:reset").click(function(){
    var timebtnType = $("input:hidden#timebtnType").val();
    $("tbody#tbdrr0 input:" + timebtnType).disBckColor();
    var tbdStr = "tbody#tbd001 input:checkbox[class^=r46_P]";
    $(tbdStr).removeAttr("disabled");
    $("tbody#tbd001 td").add("tbody#tbd001 th").css("background-color","");
    $("#chkr1passMsg").empty();
    $("form input:submit").attr("disabled", "true");         
  });
  
  // 勾选
  $(".sel").bind("click",function(){ //tr>td>input:checkbox
    	var o=$(this).find("input");
		o.attr("checked",o.attr("checked")==false);
		var chkVal = o.val();
		var isChk = o.attr("checked");
		var chkArea = Math.floor(chkVal / 6) + 1;
		var tbdStr = "tbody#tbd001 input:checkbox.r46_P" + chkArea;
		$(tbdStr).not(o).attr("checked", false);
		$(tbdStr).not(o).parent("td").css("background-color","").prevUntil("th").css("background-color","").prev().css("background-color","");
		if(isChk){  // 打勾
		  //$(tbdStr).not(this).attr("disabled", "true");
		  o.parent("td").css("background-color","#FFCC33").prevUntil("th").css("background-color","#FFCC33").prev().css("background-color","#FFCC33");
		}else{      // 取消勾选
		  //$(tbdStr).removeAttr("disabled");
		  o.parent("td").css("background-color","").prevUntil("th").css("background-color","").prev().css("background-color","");
		}
		$().chkR1pass();
  });
  
   /*$("tbody#tbd001 input:checkbox").click(function(){
   
	var chkVal = $(this).val();
    var isChk = $(this).attr("checked");
    var chkArea = Math.floor(chkVal / 6) + 1;
    var tbdStr = "tbody#tbd001 input:checkbox.r46_P" + chkArea;
	$(tbdStr).not(this).attr("checked", false);
	$(tbdStr).not(this).parent("td").css("background-color","").prevUntil("th").css("background-color","").prev().css("background-color","");
    if(isChk){  // 打勾
      //$(tbdStr).not(this).attr("disabled", "true");
      $(this).parent("td").css("background-color","#FFCC33").prevUntil("th").css("background-color","#FFCC33").prev().css("background-color","#FFCC33");
    }else{      // 取消勾选
      //$(tbdStr).removeAttr("disabled");
      $(this).parent("td").css("background-color","").prevUntil("th").css("background-color","").prev().css("background-color","");
    }
    $().chkR1pass();
	
  });*/
  
  // 送出
  $('form').submit(function() {
     var moneyNum = $("input:text#setMomney").val();
     if($("#chkr1passMsg").text() == ""){
        $().showMyMsgBox("勾选资料不齐全，无法下注");
        return false;
     }else if(moneyNum == "" || (moneyNum != parseInt(moneyNum)) || moneyNum < 1){
        $().showMyMsgBox("请输入下注金额！限数字。");
        $("input:text#setMomney").focus();
        return false;
     }else if(moneyNum < _betmin){
        $().showMyMsgBox("下注金额不能少於最低下注额("+_betmin+"元)！");
        $("input:text#setMomney").focus();
        return false;
     }else {
        $("input#disk").attr("value",$("select#slcDisk option:selected").val());
        $("input#r46_R1pass").val("");
        var chkP1 = $("tbody#tbd001 input.r46_P1:checked");
        var chkP2 = $("tbody#tbd001 input.r46_P2:checked");
        var chkP3 = $("tbody#tbd001 input.r46_P3:checked");
        if($(chkP1).size() == 1 && $(chkP2).size() == 1 && $(chkP3).size() == 1){
          var chkVal3 = $(chkP3).val();
          var chkVal2 = $(chkP2).val();
          var chkVal1 = $(chkP1).val();
          $("input#r46_R1pass").val(moneyNum + "," + chkVal1 + "," + chkVal2 + "," + chkVal3);
          return true;
        }else{
          $().showMyMsgBox("勾选资料异常，请重新整理页面");
          return false;
        }
        
        
     }
  });
  
  
  
  
});

</script>
<div id="errormsg"></div>
<div id="mainPageData">
<form action="{action}" method="post" style="margin-top:0" >
<input type="hidden" value="{bettypegroup}" name="bettypegroup" />
<input type="hidden" value="{timebtnType}" name="timebtnType" id="timebtnType" />
<input type="hidden" value="" name="disk" id="disk" />
<input type="hidden" value="" name="r46_R1pass" id="r46_R1pass" />


<table class="tblMy3D" width="700" id="tblNowBet01">
<thead>
<tr class="bgClc_{gametype}" style="font-weight: 100;">
<th colspan="6">佰OXX</th>
<th colspan="6">拾XOX</th>
<th colspan="6">个XXO</th>
</tr>

<tr class="bgClc_{gametype}" style="font-weight: 100;">
<th>号码</th><th>赔率</th><th>选择</th>
<th>号码</th><th>赔率</th><th>选择</th>
<th>号码</th><th>赔率</th><th>选择</th>
<th>号码</th><th>赔率</th><th>选择</th>
<th>号码</th><th>赔率</th><th>选择</th>
<th>号码</th><th>赔率</th><th>选择</th>
</tr>
</thead>
<tbody id="tbd001">
<tr class="td2" align="center">
<th class="title02_3d">大</th><td class="betnum" id="td_r46_0">&nbsp;</td><td class="sel"><input type="checkbox" style="display:none" class="r46_P1" value="0" size="3"></td> 
<th class="title02_3d">小</th><td class="betnum" id="td_r46_1">&nbsp;</td><td class="sel"><input type="checkbox" style="display:none" class="r46_P1" value="1" size="3"></td>
<th class="title02_3d">大</th><td class="betnum" id="td_r46_6">&nbsp;</td><td class="sel"><input type="checkbox" style="display:none" class="r46_P2" value="6" size="3"></td>
<th class="title02_3d">小</th><td class="betnum" id="td_r46_7">&nbsp;</td><td class="sel"><input type="checkbox" style="display:none" class="r46_P2" value="7" size="3"></td>
<th class="title02_3d">大</th><td class="betnum" id="td_r46_12">&nbsp;</td><td class="sel"><input type="checkbox" style="display:none" class="r46_P3" value="12" size="3"></td>
<th class="title02_3d">小</th><td class="betnum" id="td_r46_13">&nbsp;</td><td class="sel"><input type="checkbox" style="display:none" class="r46_P3" value="13" size="3"></td>
</tr>

<tr class="td2" align="center">
<th class="title02_3d">单</th><td class="betnum" id="td_r46_2">&nbsp;</td><td class="sel"><input type="checkbox" style="display:none" class="r46_P1" value="2" size="3"></td> 
<th class="title02_3d">双</th><td class="betnum" id="td_r46_3">&nbsp;</td><td class="sel"><input type="checkbox" style="display:none" class="r46_P1" value="3" size="3"></td>
<th class="title02_3d">单</th><td class="betnum" id="td_r46_8">&nbsp;</td><td class="sel"><input type="checkbox" style="display:none" class="r46_P2" value="8" size="3"></td>
<th class="title02_3d">双</th><td class="betnum" id="td_r46_9">&nbsp;</td><td class="sel"><input type="checkbox" style="display:none" class="r46_P2" value="9" size="3"></td>
<th class="title02_3d">单</th><td class="betnum" id="td_r46_14">&nbsp;</td><td class="sel"><input type="checkbox" style="display:none" class="r46_P3" value="14" size="3"></td>
<th class="title02_3d">双</th><td class="betnum" id="td_r46_15">&nbsp;</td><td class="sel"><input type="checkbox" style="display:none" class="r46_P3" value="15" size="3"></td>
</tr>

<tr class="td2" align="center">
<th class="title02_3d">质</th><td class="betnum" id="td_r46_4">&nbsp;</td><td class="sel"><input type="checkbox" style="display:none" class="r46_P1" value="4" size="3"></td> 
<th class="title02_3d">合</th><td class="betnum" id="td_r46_5">&nbsp;</td><td class="sel"><input type="checkbox" style="display:none" class="r46_P1" value="5" size="3"></td>
<th class="title02_3d">质</th><td class="betnum" id="td_r46_10">&nbsp;</td><td class="sel"><input type="checkbox" style="display:none" class="r46_P2" value="10" size="3"></td>
<th class="title02_3d">合</th><td class="betnum" id="td_r46_11">&nbsp;</td><td class="sel"><input type="checkbox" style="display:none" class="r46_P2" value="11" size="3"></td>
<th class="title02_3d">质</th><td class="betnum" id="td_r46_16">&nbsp;</td><td class="sel"><input type="checkbox" style="display:none" class="r46_P3" value="16" size="3"></td>
<th class="title02_3d">合</th><td class="betnum" id="td_r46_17">&nbsp;</td><td class="sel"><input type="checkbox" style="display:none" class="r46_P3" value="17" size="3"></td>
</tr>

</tbody>
</table>

<div class="btnDivArea">
  <span id="chkr1passMsg" style="font-weight:bold;"></span>
  金额
  <input type="text" value="" id="setMomney" size="3" />
  <input type="submit" value="确定" />
  <input type="reset" value="取消" />
</div>
</form>
※ <font color="red">显示之赔率为参考用，一律以系统即时运算赔率为准。</font><br />

</div>
</div>   